home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 6 / FM Towns Free Software Collection 6.iso / ms_dos / gds / source / gds104.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-08  |  1014 b   |  46 lines

  1.  
  2. /*
  3.  *
  4.  *    GDS104 : ドットデ-タの読み込み
  5.  *
  6.  */
  7.  
  8. #include <stdio.h>
  9. #include <dos.h>
  10. #include <math.h>
  11.  
  12. unsigned char *GDS_get_block(signed int x1,signed int y1,signed int x2,signed int y2,unsigned char page) {
  13.    union  REGS  inregs, outregs;
  14.    struct SREGS segregs;
  15.    static struct {
  16.       unsigned int offset;
  17.       unsigned int segment;
  18.       unsigned char page;
  19.       unsigned char dust;
  20.       signed int x1;
  21.       signed int y1;
  22.       signed int x2;
  23.       signed int y2;
  24.    } work;
  25.    unsigned int size;
  26.    unsigned char *data;
  27.  
  28.    size=(((abs(x1-x2)+1)*(abs(y1-y2)+1)+7)/8)*4;
  29.    if((data=(unsigned char *)malloc(size))==NULL)
  30.       return NULL;
  31.    work.offset=(unsigned int)data;
  32.    work.segment=_DS;
  33.    work.page=page;
  34.    work.dust=0;
  35.    work.x1=x1;
  36.    work.y1=y1;
  37.    work.x2=x2;
  38.    work.y2=y2;
  39.    segread(&segregs);
  40.    segregs.ds=_DS;
  41.    inregs.x.di=(unsigned int)&work;
  42.    inregs.x.ax=0x8500;
  43.    int86x(0x92,&inregs,&outregs,&segregs);
  44.    return data;
  45. }
  46.